<extend name="Base/base" />
<block name='head'>
    <link rel="stylesheet" type="text/css" href="/Public/Admin/css/personal.css"/>
    <link href="/Public/Admin/css/new_plan.css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="/Public/Admin/css/diary.css"/>
    <!--文件上传-->
    <script type="text/javascript" src="/Public/Cropper/js/ajaxfileupload.js" ></script>
    <style>
        .textarea{height:50px;width:90%}
        .checkCont p{float:left;}
        .checkCont a{margin-left:10px;display: inline-block;}
        .fujian{margin:0;}
        .c-red{color:red}
        .pointer{cursor: pointer}
        .deptList th{text-align:center;}
        .deptList td{text-align:center;}
        ul.dynatree-container a.cur_user{color:#0066cc;font-weight:bolder;font-size:15px;}
        #larry-body{background:#fff;}
    </style>
</block>
<block name="content" >
    <section class="layui-larry-box mian-page page-attendanceStatistics">
	<div class="larry-personal">
            <div class="layui-tab">
                <div class="layui-tab-item layui-field-box layui-show " >
                    <div class="userinfo" style="width:80%;margin: 10px auto;">
                        <a class="on top pointer" data-type="unit">单位管理</a>
                        <a class="top pointer" data-type="dept">部门管理</a>
                        <!--<a class="top pointer" data-type="user">用户管理</a>-->
                        <div class="info unit">
                            <!-- 表单项 -->
                            <form class="layui-form" id="form1" action="">
                                <input type='hidden' name='unit_no' value='{$unit.unit_no}'>
                                <table class="table table-bordered">
                                    <colgroup>
                                        <col width="100">
                                        <col width="400">
                                    </colgroup>
                                    <thead>
                                        <tr>
                                            <td colspan="2">基本信息</td>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr class="TableData">
                                            <td class="td-head">单位名称：</td>
                                            <td>
                                                <input name="UNIT_NAME" class="layui-input" value="{$unit.unit_name}" type="text">
                                            </td>
                                        </tr>
                                        <tr class="TableData">
                                            <td class="td-head">电话：</td>
                                            <td>
                                                <input name="TEL_NO" class="layui-input" value="{$unit.tel_no}" type="text">
                                            </td>
                                        </tr>
                                        <tr class="TableData">
                                            <td class="td-head">传真：</td>
                                            <td>
                                                <input name="FAX_NO" class="layui-input" value="{$unit.fax_no}" type="text">
                                            </td>
                                        </tr>
                                        <tr class="TableData">
                                            <td class="td-head">邮编：</td>
                                            <td>
                                                <input name="POST_NO" class="layui-input" value="{$unit.post_no}" type="text">
                                            </td>
                                        </tr>
                                        <tr class="TableData">
                                            <td class="td-head">地址：</td>
                                            <td>
                                                <input name="ADDRESS" class="layui-input" value="{$unit.address}" type="text">
                                            </td>
                                        </tr>
                                        <tr class="TableData">
                                            <td class="td-head">网站：</td>
                                            <td>
                                                <input name="URL" class="layui-input" value="{$unit.url}" type="text">
                                            </td>
                                        </tr>
                                        <tr class="TableData">
                                            <td class="td-head">电子信箱：</td>
                                            <td>
                                                <input name="EMAIL" class="layui-input" value="{$unit.email}" type="text">
                                            </td>
                                        </tr>
                                        <tr class="TableData">
                                            <td class="td-head">开户行：</td>
                                            <td>
                                                <input name="BANK_NAME" class="layui-input" value="{$unit.bank_name}" type="text">
                                            </td>
                                        </tr>
                                        <tr class="TableData">
                                            <td class="td-head">账号：</td>
                                            <td>
                                                <input name="BANK_NO" class="layui-input" value="{$unit.bank_no}" type="text">
                                            </td>
                                        </tr>
                                        <tr class="TableData">
                                            <td class="td-head">附件上传：</td>
                                            <td>
                                                <a href="#" id="upload" style='margin-top: 7px;display: inline-block;font-size: 12px;'><span class="fj">上传附件</span><span class="icon_add">&#xe638;</span></a>
                                                <div class="filename-cont">
                                                    <span><if condition="$info.uploads neq ''">{$info.uploads}<img src="/Public/Index/img/close.png" style="width:15px" class="pointer delfile" data-fileurl="{$info.uploads_url}"/></if></span>
                                                </div>
                                                <input type="file" id="inputImage" name='imgfile' style="display:none">
                                                <input type="hidden" id="filename" name="uploads" value="{$info.uploads}">
                                                <input type="hidden" id="fileurl" name="uploads_url" value="{$info.uploads_url}">
                                                <input type="hidden" name="url" value="{:U('Base/delFile',array('table'=>'unit','field'=>'unit_no','id'=>$unit['unit_no']))}">
                                            </td>
                                        </tr>
                                        <tr class="TableData">
                                            <td colspan="2">
                                                <textarea name="CONTENT" id="content">{$unit.content}</textarea>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                                <div style='margin-left:38%;'>
                                    <a class="layui-btn submitUnit" data-url="{:U('organize')}" data-form="">保存设置</a>
                                </div>
                            </form>
                        </div>
                        <div class="account dept" style="display:none;margin-top:20px;">
                            <table class="table table-bordered deptList">
                                <thead style='background-color:#ecf3f9'>
                                    <th>部门名称</th>
                                    <th>部门排序号</th>
                                    <th>上级部门</th>
                                    <th>部门电话</th>
                                    <th>部门传真</th>
                                    <th>部门职能</th>
                                    <th>操作</th>
                                </thead>
                                <foreach name='department' item='data'>
                                    <tr>
                                        <td>{$data.dept_name}</td>
                                        <td>{$data.dept_no}</td>
                                        <td>{$data.dept_parent}</td>
                                        <td>{$data.tel_no}</td>
                                        <td>{$data.fax_no}</td>
                                        <td>{$data.dept_func}</td>
                                        <td><a class='delDept pointer' data-id='{$data.dept_id}' data-url='{:U("delDept")}' style='color:#2a6496'>删除</a></td>
                                    </tr>
                                </foreach>
                            </table>
                            <form class="layui-form" id="form2" action="">
                                <table class="table table-bordered" width="500">
                                    <thead>
                                        <tr>
                                            <td colspan="2" class="Big"> <span class="">新建部门</span><br>
                                            </td>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr class="Big">
                                            <td class="TableData" width="150px">部门排序号：</td>
                                            <td class="TableData">
                                                <input name="DEPT_NO" size="3" maxlength="3" class="layui-input" value="{$dept.dept_no}" type="text" onkeyup="value=value.replace(/[^\d]/g,'')">
                                                <span>3位数字，用于同一级次部门排序，不能重复 </span>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="TableData">部门名称：</td>
                                            <td class="TableData">
                                                <input name="DEPT_NAME" class="layui-input" value="{$dept.dept_name}" type="text">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="TableData">上级部门：</td>
                                            <td class="TableData">
                                                <select name="DEPT_PARENT" class="layui-input search_input type_id">
                                                    <option value=""></option>
                                                    <foreach name="topDept" item="top">
                                                        <option value="{$top.dept_id}" {$dept_id == $top['dept_id'] ? 'selected' : ''}>{$top.dept_name}</option>
                                                    </foreach>
                                                </select>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="TableData">部门主管：</td>
                                            <td class="TableData">
                                                <div class=" layui-input checkCont value" style="background-color: #eeeeee;">
                                                    <p class="textarea addUser addUser_1" data-id="1" data-key="manager">
                                                        <span></span>
                                                        <foreach name="user_ids" item="person">
                                                            <span class="one-name">
                                                                <a>{$person|getChineseName}</a>
                                                                <img class="pointer delOperator" data-id="{$person}" src="/Public/Index/img/close_red.png" alt="close" width="12">
                                                                <input type="hidden" name="manager[]" value="{$person}">
                                                                <input type="hidden" name="manager_names[]" value="{$person|getChineseName}">
                                                            </span>
                                                        </foreach>
                                                    </p>
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="TableData">部门助理：</td>
                                            <td class="TableData">
                                                <div class="layui-input checkCont value" style="background-color: #eeeeee;">
                                                    <p class="textarea addUser addUser_2" data-id="2" data-key="assistant">
                                                        <span></span>
                                                        <foreach name="user_ids" item="person">
                                                            <span class="one-name">
                                                                <a>{$person|getChineseName}</a>
                                                                <img class="pointer delOperator" data-id="{$person}" src="/Public/Index/img/close_red.png" alt="close" width="12">
                                                                <input type="hidden" name="assistant[]" value="{$person}">
                                                                <input type="hidden" name="assistant_names[]" value="{$person|getChineseName}">
                                                            </span>
                                                        </foreach>
                                                    </p>
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="TableData">电话：</td>
                                            <td class="TableData">
                                                <input name="TEL_NO" class="layui-input" value="{$dept.tel_no}" type="text"  >
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="TableData">传真：</td>
                                            <td class="TableData">
                                                <input name="FAX_NO" class="layui-input" value="{$dept.fax_no}" type="text"  >
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="TableData">部门职能：</td>
                                            <td class="TableData">
                                                <textarea name="DEPT_FUNC" style='border: 1px solid #e6e6e6;width:100%;height:90px;'>{$dept.dept_func}</textarea>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                                <div style='margin-left:38%;'>
                                    <a class="layui-btn saveDept" data-url="{:U('saveDept')}" data-form="">保存设置</a>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
</block>
<block name="script">
    <script type="text/javascript" src="/Public/Admin/js/system.js"></script>
    <!--编辑器-->
    <link rel="stylesheet" href="__PUBLIC__/static/ueditor/themes/default/css/ueditor.css"/>
    <script type="text/javascript" src="__PUBLIC__/static/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" src="__PUBLIC__/static/ueditor/ueditor.all.min.js"></script>
    <script type="text/javascript">
        $(initSystem());
        var width = $('.editorArea').width();
        var ue = UE.getEditor('content', {
            initialFrameWidth: width,
            initialFrameHeight: 200,
            toolbars: [[
                    "source", "undo", "redo", "insertunorderedlist", "insertorderedlist", "unlink", "link",
                    "searchreplace", "preview", "pagebreak", "simpleupload", "emotion",
                    "date", "time", "horizontal", "pasteplain",
                    "bold", "italic", "underline", "strikethrough", "forecolor", "backcolor",
                    "superscript", "subscript", "justifyleft", "justifycenter", "justifyright", "justifyjustify",
                    "formatmatch", "removeformat", "lineheight", "fontfamily", "fontsize",
                ]],
        });
    </script>
</block>
